package hcn.protocol.brandnew.zhenliao.shouma;

import com.fasterxml.jackson.annotation.JsonFormat;
import ctd.util.xml.jaxb.DateTimeAdapter;
import hcn.protocol.brandnew.BaseRequest;
import lombok.Data;
import org.atag.sysrouter.annotation.DictionaryMapping;

import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Date;
import java.util.List;


/**
 * 获取手术消息-请求消息 - ODS_03080041
 *
 * @author enjoyLife
 */
@Data
@XmlRootElement(name = "MsgBody")
@XmlAccessorType(XmlAccessType.FIELD)
public class ListQueryRequest extends BaseRequest {

    /**
     * 医疗机构组织机构代码
     */
    @XmlElement(name = "VisitOrganization")
    private String visitOrganization;
    /**
     * 查询组合类型
     */
    @XmlElement(name = "QueryType")
    private String queryType;
    /**
     * 诊疗卡集合
     */
    @XmlElementWrapper(name = "MedicalCardIdLists")
    @XmlElement(name = "MedicalCardIdList")
    private List<MedicalCardIdList> medicalCardIdLists;
    /**
     * 患者标识集合
     */
    @XmlElementWrapper(name = "SourcePatientIdLists")
    @XmlElement(name = "SourcePatientIdList")
    private List<SourcePatientIdList> sourcePatientIdLists;
    /**
     * 证件集合
     */
    @XmlElementWrapper(name = "IdCardLists")
    @XmlElement(name = "IdCardList")
    private List<IdCardList> idCardLists;
    /**
     * 手术记录单编号
     */
    @XmlElement(name = "OperationSourceId")
    private String operationSourceId;
    /**
     * 开始时间
     */
    @XmlElement(name = "BeginDateTime")
    @XmlJavaTypeAdapter(DateTimeAdapter.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date beginDateTime;
    /**
     * 结束时间
     */
    @XmlElement(name = "EndDateTime")
    @XmlJavaTypeAdapter(DateTimeAdapter.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endDateTime;
    /**
     * 医护人员代码
     */
    @XmlElement(name = "DoctorCode")
    private String doctorCode;
    /**
     * 科室代码
     */
    @XmlElement(name = "DeptCode")
    private String deptCode;
    /**
     * 患者姓名PC
     */
    @XmlElement(name = "Keyword")
    private String keyword;
    /**
     * 事件类型：1申请时间 2安排时间---PC端
     */
    @XmlElement(name = "DateType")
    private String dateType;

    @XmlElement(name = "PageNo")
    private Integer pageNo = 1;

    @XmlElement(name = "PageSize")
    private Integer pageSize = 20;

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class MedicalCardIdList {

        /**
         * 就诊卡类别代码
         */
        @XmlElement(name = "MedicalCardType")
        private String medicalCardType;
        /**
         * 就诊卡号
         */
        @XmlElement(name = "MedicalCardId")
        private String medicalCardId;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class SourcePatientIdList {

        /**
         * 业务系统患者档案ID
         */
        @XmlElement(name = "SourcePatientId")
        private String sourcePatientId;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class IdCardList {

        /**
         * 身份证件号码
         */
        @XmlElement(name = "IdCard")
        private String idCard;
        /**
         * 身份证件类别代码
         */
        @XmlElement(name = "IdCardCode")
        @DictionaryMapping(id = "CV02_01_101")
        private String idCardCode;
    }

}
